<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>存储设置</title>
    <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
    <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
</head>
<body class="pear-container">


<div class="layui-card">
    <div class="layui-card-body">

        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">基础设置</li>
                <li permission="app.filesystem.admin.setting.savePublic">本地(开放)</li>
                <li permission="app.filesystem.admin.setting.saveLocal">本地(私有)</li>
                <li permission="app.filesystem.admin.setting.saveFtp">FTP</li>
                <li permission="app.filesystem.admin.setting.saveOss">阿里云</li>
                <li permission="app.filesystem.admin.setting.saveQiniu">七牛云</li>
                <li permission="app.filesystem.admin.setting.saveCos">腾讯云</li>
                <li permission="app.filesystem.admin.setting.saveS3">S3</li>
                <li permission="app.filesystem.admin.setting.upload">上传测试</li>
            </ul>
            <div class="layui-tab-content">


                <!-- 附件设置 -->
                <div class="layui-tab-item layui-show">
                    <form class="layui-form" onsubmit="return false" lay-filter="setting">
                        <div class="layui-form-item">
                            <label class="layui-form-label">默认存储</label>
                            <div class="layui-input-block">
                                <input type="radio" name="default" value="public" title="本地(开放)">
                                <input type="radio" name="default" value="local" title="本地(私有)">
                                <input type="radio" name="default" value="oss" title="阿里云OSS">
                                <input type="radio" name="default" value="cos" title="腾讯云COS">
                                <input type="radio" name="default" value="qiniu" title="七牛云">
                                <input type="radio" name="default" value="ftp" title="FTP">
                                <input type="radio" name="default" value="s3" title="s3">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">单文件限制</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="number" name="max_size" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">如你需设置1M大小 你需要以 1024*1024*1来计算得到结果1048576</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">允许上传类型</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="ext_yes" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">以英文逗号分隔</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">禁止上传类型</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="ext_no" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">以英文逗号分隔</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveSetting">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--S 本地开放 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="public">
                        <div class="layui-form-item">
                            <label class="layui-form-label">文件目录</label>
                            <div class="layui-input-inline">
                                <input type="text" name="path" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">开放目录默认在public目录 如果你需放在子目录里可设置为uploads</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline" style="min-width: 300px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址需加上上面设置的目录,完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="savePublic">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E 本地开放 -->
                <!--S 本地私有 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="local">
                        <div class="layui-form-item">
                            <label class="layui-form-label">文件目录</label>
                            <div class="layui-input-inline">
                                <input type="text" name="path" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">私有目录默认在runtime目录 如果你需放在子目录里可设置为uploads</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline" style="min-width: 300px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址设置可访问的完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveLocal">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E 本地私有 -->

                <!--S FTP设置 -->
                <div class="layui-tab-item">

                    <form class="layui-form" onsubmit="return false" lay-filter="ftp">
                        <div class="layui-form-item">
                            <label class="layui-form-label">host</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="host" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">username</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="username" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">password</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="password" name="password" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">port</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="number" name="port" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">root</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="root"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">passive</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="passive" lay-skin="switch" lay-filter="switchTest">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">ssl</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="ssl" lay-skin="switch" lay-filter="switchTest">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline" style="min-width: 300px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址需完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveFtp">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E FTP设置 -->
                <!--S 阿里云 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="oss">
                        <div class="layui-form-item">
                            <label class="layui-form-label">accessId</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="access_id" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">accessKey</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="access_key" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">bucket</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="bucket" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">存储桶</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">endpoint</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="endpoint" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">OSS外网节点或自定义外部域名oss-cn-shanghai.aliyuncs.com</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">ssl</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="ssl" lay-skin="switch" lay-filter="switchTest">
                            </div>
                            <div class="layui-form-mid layui-word-aux">true to use 'https://' and false to use 'http://'. default is false</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline"  style="min-width: 400px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址需完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveOss">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E 阿里云 -->
                <!--S 七牛云 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="qiniu">
                        <div class="layui-form-item">
                            <label class="layui-form-label">accessKey</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="accessKey" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">secretKey</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="secretKey" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">bucket</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="bucket" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">存储桶</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">domain</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="domain" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址需完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveQiniu">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E 七牛云 -->
                <!--S 腾讯云 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="cos">
                        <div class="layui-form-item">
                            <label class="layui-form-label">region</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="region" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">app_id</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="app_id" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">secret_id</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="secret_id" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">secret_key</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="secret_key" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">bucket</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="bucket" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">存储桶</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">signed_url</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="signed_url" lay-skin="switch" lay-filter="switchTest">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">read_from_cdn</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="read_from_cdn" lay-skin="switch" lay-filter="switchTest">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址需完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveCos">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E 腾讯云 -->
                <!--S S3 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="s3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">key</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="key" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">secret</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="secret" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">region</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="region" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">version</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="version" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">bucket_name</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="bucket_name" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">存储桶</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">endpoint</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="endpoint" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">bucket_endpoint</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="bucket_endpoint" lay-skin="switch" lay-filter="switchTest">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">use_path_style_endpoint</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="checkbox" checked="" name="use_path_style_endpoint" lay-skin="switch" lay-filter="switchTest">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">访问地址</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="url" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">访问地址需完整url</div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveS3">
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E S3 -->
                <!--S 上传测试 -->
                <div class="layui-tab-item">
                    <form class="layui-form" onsubmit="return false" lay-filter="upload">
                        <div class="layui-form-item">
                            <label class="layui-form-label">上传附件</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="image" permission="app.filesystem.admin.setting.upload">
                                    <i class="layui-icon layui-icon-upload"></i>上传图片
                                </button>
                            </div>
                        </div>
                        <div style="padding-left: 160px;padding-bottom: 20px;">
                            <img id="imgView" style="max-width: 400px; max-height: 400px" />
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">adapter</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="adapter" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">origin_name</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="origin_name" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">file_name</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="file_name" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">extension</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="extension" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">size</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="size" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">file_width</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="file_width" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">file_height</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="file_height" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">file_url</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="file_url" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">mime_type</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="mime_type" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">storage_key</label>
                            <div class="layui-input-inline" style="min-width: 400px">
                                <input type="text" name="storage_key" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                    </form>
                </div>
                <!--E 上传测试 -->
            </div>
        </div>

    </div>
</div>


<script src="/app/admin/component/layui/layui.js"></script>
<script src="/app/admin/component/pear/pear.js"></script>
<script src="/app/admin/admin/js/permission.js"></script>
<script src="/app/admin/admin/js/common.js"></script>

<!-- 邮件设置 邮件测试 -->
<script>
    layui.use(["form", "popup","upload"], function(){
        let form = layui.form;
        let $ = layui.jquery;

        $.ajax({
            url: "/app/filesystem/admin/setting/get",
            success: function (res) {
                if (res.code) {
                    return layui.popup.failure(res.msg);
                }
                form.val("setting", res.data);
                form.val("public", res.data.storage.public);
                form.val("local", res.data.storage.local);
                form.val("oss", res.data.storage.oss);
                form.val("ftp", res.data.storage.ftp);
                form.val("cos", res.data.storage.cos);
                form.val("qiniu", res.data.storage.qiniu);
                form.val("s3", res.data.storage.s3);
            }
        });

        // 基础
        form.on("submit(saveSetting)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/save",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });

        // 基础
        form.on("submit(saveLocal)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/saveLocal",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        form.on("submit(savePublic)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/savePublic",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        //

        // 阿里云
        form.on("submit(saveOss)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/saveOss",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        // 七牛云
        form.on("submit(saveQiniu)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/saveQiniu",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        // 腾讯云
        form.on("submit(saveCos)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/saveCos",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        // FTP
        form.on("submit(saveFtp)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/saveFtp",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        form.on("submit(saveS3)", function(data){
            $.ajax({
                url: "/app/filesystem/admin/setting/saveS3",
                dataType: "json",
                type: "POST",
                data: data.field,
                success: function (res) {
                    if (res.code) {
                        return layui.popup.failure(res.msg);
                    }
                    return layui.popup.success("操作成功");
                }
            });
            return false;
        });
        layui.upload.render({
            elem: "#image",
            url: "/app/filesystem/admin/setting/upload",
            done: function (res) {
                if (res.code) {
                    return layui.popup.failure(res.msg);
                }
                $('#imgView').attr('src', res.data.file_url);
                form.val("upload", res.data);
                return layui.popup.success("操作成功");

            }
        });
    });
</script>

<style>

    .layui-input-block {
        margin-left: 150px;
    }

    .layui-form-label {
        width:120px;
    }

</style>
</body>
</html>

